<h1>Listing posts</h1>

<table>
    <thead>
    <tr>
        <th>Title</th>
        <th>Body</th>
        <th>User</th>
        <th>Campaign</th>
        <th></th>
        <th></th>
        <th></th>
    </tr>
    </thead>

    <tbody>
    <% @posts.each do |post| %>
        <tr>
            <td><%= post.title %></td>
            <td><%= post.body %></td>
            <td><%= post.user_id %></td>
            <td><%= post.campaign_id %></td>
            <td><%= link_to 'Show', post %></td>
            <td><%= link_to 'Edit', edit_post_path(post) %></td>
            <td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %></td>
        </tr>
    <% end %>
    </tbody>
</table>

<br>

<%= link_to 'New Post', new_post_path %>
